package com.lyandwc.lw_bbs.security.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "jwt-config")
public class JWTConfig {
    public static String secret;
    public static String tokenHeader;
    public static String tokenPrefix;
    public static int expiration;
    public static String[] whiteListAll;
    public static String[] whiteListGet;

    public void setSecret(String secret) {
        JWTConfig.secret = secret;
    }

    public void setTokenHeader(String tokenHeader) {
        JWTConfig.tokenHeader = tokenHeader;
    }

    public void setTokenPrefix(String tokenPrefix) {
        JWTConfig.tokenPrefix = tokenPrefix + " ";
    }

    public void setExpiration(int expiration) {
        JWTConfig.expiration = expiration * 1000;
    }

    public void setWhiteListAll(String[] whiteListAll) {
        JWTConfig.whiteListAll = whiteListAll;
    }

    public void setWhiteListGet(String[] whiteListGet) {
        JWTConfig.whiteListGet = whiteListGet;
    }
}
